package com.fjw.dao.impl;

import com.fjw.dao.UserDao;
import com.fjw.entity.User;
import com.fjw.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class UserDaoImpl  implements UserDao {
    private QueryRunner qr = DBUtils.DB.qr;
    @Override
    public List<User> selectByUname(String uname) throws SQLException {
        String sql ="select *  from user where uname =?";
        List<User> userList = qr.query(sql, new BeanListHandler<User>(User.class), uname);
        return userList;
    }
}
